package cn.source.web.controller.api;

import cn.source.common.constant.HttpStatus;
import cn.source.common.core.controller.BaseController;
import cn.source.common.core.domain.AjaxResult;
import cn.source.common.core.page.TableDataInfo;
import cn.source.common.utils.StringUtils;
import cn.source.system.domain.HouseHeart;
import cn.source.system.domain.HouseRoom;
import cn.source.system.service.IHouseHeartService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class HouseHeartController extends BaseController {


    private IHouseHeartService houseHeartService;
    /**
     * @Description: 收藏/取消收藏
     */
    @PostMapping("/addHeart")
    public AjaxResult saveHeart(@RequestBody HouseHeart houseHeart) {
        houseHeartService.addHeart(houseHeart);
        return AjaxResult.success();
    }




    /**
     * @Description: 获取收藏房源列表
     */
    @GetMapping("/findHouseHeartList")
    public TableDataInfo getHouseHeartList() {
        startPage();
        List<HouseRoom> list = houseHeartService.getHouseHeartList();
        return getDataTable(list);
    }


}
